global !p
from vimsnippets import foldmarker, make_box, get_comment_format
endglobal

snippet todo "TODO comment" bw
`!p snip.rv=get_comment_format()[0]` TODO <`!v strftime('%y-%m-%d')`, `!v g:snips_author`> `!p snip.rv=get_comment_format()[2]`$0
endsnippet

################################################################################
#                                    gradle                                    #
################################################################################

snippet tag 
// tag::$1[]$0
endsnippet

snippet end
// end::$1[]$0
endsnippet

snippet date "输出日期"
`!v strftime('%Y-%m-%d')`$0
endsnippet

snippet dt "输出日期"
`!v strftime('%Y/%m/%d')`$0
endsnippet

snippet kbfn "Kotlin build file name"
rootProject.name = 'build.gradle.kts'$0
endsnippet

#####################
#  Javascript Part  #
#####################

snippet wol "window.onload = fn" 
window.onload = function() {
	${0}
}
endsnippet

snippet $$ "jquery $(function(){});" 
$(function() {
	${0}
})
endsnippet

# did: document.getElementById('')
snippet did "document.getElementById"
document.getElementById('${1:id}')${0}
endsnippet

################################################################################
#                                  book.json                                   #
################################################################################

snippet bookjson
{
    "title": "第一本 Gitbook",
    "author": "codergege",
    "links": {
        "sidebar": {
            "Home": "http://www.google.com"
        }
    },
    "plugins": [
		"mathjax",
        "theme-comscore",
        "sharing-plus",
        "search-pro",
        "collapsible-menu",
        "ace",
        "url-embed",
        "-sharing",
        "-lunr",
        "-search",
        "-livereload",
        "-highlight"
    ],
    "pluginsConfig": {
        "theme-default": {
            "showLevel": false
        },
        "sharing": {
            "douban": false,
            "facebook": false,
            "google": false,
            "hatenaBookmark": false,
            "instapaper": false,
            "line": false,
            "linkedin": false,
            "messenger": false,
            "pocket": false,
            "qq": false,
            "qzone": false,
            "stumbleupon": false,
            "twitter": false,
            "viber": false,
            "vk": false,
            "weibo": false,
            "whatsapp": false,
            "all": [
                "facebook",
                "google",
                "twitter",
                "weibo",
                "qq",
                "linkedin",
                "qzone",
                "douban"
            ]
        }
    },
    "pdf": {
        "pageNumbers": true, 
        "fontFamily": "Anonymous",
        "fontSize": 16,
        "paperSize": "a4",
        "margin": {
            "right": 62,
            "left": 62,
            "top": 56,
            "bottom": 56
        }
    }
}
endsnippet

################################################################################
#                                .tern_project                                 #
################################################################################
snippet tern ".tern_project settings"
{
  "libs": [
    "browser",
    "jquery",
    "react",
    "underscore"
  ],
  "plugins": {
    "requirejs": {
      "baseURL": "./",
      "paths": {}
    },
    "node": {}
  }
}
endsnippet

################################################################################
#                                      题库                                      #
################################################################################

#############
#  Rust 基础  #
#############
snippet tk_rs_1 "Rust 基础题库 1"
// Rust 基础练习 1
// 1. 将 struct List(Vec<i32>) 打印成 [0: 1, 1: 2, 2: 3] 格式.
// 2. 将下面的 Matrix 输出为 
// (1.1, 1.2)
// (2.1, 2.2)
// 3. 写一个函数 transpose, 接收 Matrix 作为参数, 输出 Matrix, 将里面的每个数的
// 整数部分和小数部分颠倒. 2.1 -> 1.2
#[derive(Debug)]
struct Matrix(f32, f32, f32, f32);
endsnippet

snippet tk_rs_2 "Rust 基础题库 2"
// Rust 基础练习 2
// 为 Number 添加 From trait
//#[derive(Debug)]
//struct Number {
//    value: i32,
//}
endsnippet
